/*
*	Project: Aethon
*
*	File: Terrain.h
*
*	Author: Caleb Reinking
*
*	Date: 2/15/2009
*
*   Purpose: The Terrain is a crucial part of the final environment. The
*            terrain will be 3D texture mapped and contain the ability
*            to interact with model collision spheres to obtain a realistic
*            way of simulating gravity and ground collision.
*            Terrain Class Specification File
*/

#ifndef TERRAIN_HEADER
#define TERRAIN_HEADER

#define MAX_MAP_SIZE 512

#include "../include/CollisionSphere.h"
#include "../include/ModelPart.h"
#include <string>

using namespace std;

//#############################################################################
class Terrain{

    private:
       bool hasVisibility;
       bool hasCollisions;  
       float heightGrid[MAX_MAP_SIZE][MAX_MAP_SIZE];
       ModelPart modPart;
       int dimension;
       float separationFact;
       
	
	public:	
	    //-------------------------------------------------------------------------	
		//------------------- constructors ----------------------------------------
		//##########################################################################
		Terrain()
		{
           cout << "Entering terrain constructor" << endl;
           hasVisibility = true;
		   hasCollisions = true;
		   modPart = ModelPart();
		   dimension = 0;
		   separationFact = 1.0;
		}

		Terrain( bool vis, bool collision )
		{
		   hasVisibility = vis;
		   hasCollisions = collision;
		   modPart = ModelPart();
		   dimension = 0;
		   separationFact = 1.0;
		}
		
		//-------------------------------------------------------------------------	
		//------------------- gets and sets ---------------------------------------
		//##########################################################################
		void setHasVisibility(bool vis) 
		{
			 hasVisibility = vis;
		}//end setHasVisibility
			
		//##########################################################################
		bool getHasVisibility() 
		{
			 return hasVisibility;
		}//end getHasVisibility
			
			
		//##########################################################################
		void setHasCollsions(bool collision) 
		{
			 hasCollisions = collision;
		}//end setHasCollisions
			
		//##########################################################################
		bool getHasCollisions() 
		{
			 return hasCollisions;
		}//end getHasCollisions
		
		float getElementAt( int x, int y )
		{
             return heightGrid[x][y];
        }
		
	   void display();
	   int collidesWith( CollisionSphere sphere );
	   int load( string heightFileName, string texFileName );
	
};//end class

#endif //TERRAIN_HEADER

